<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="icon" href="/image/favicon.ico" type="image/x-icon">
	<link href="js/util.js">
<style type="text/css">

* {
	margin: 0px;
	padding: 0px;
}

#div1 {
	min-width: 954px;
	height: 100%;
}

#div2 {
	min-width: 954px;
	line-height: 60px;
	text-indent: 20px;
	vertical-align: middle;
	background-color: gainsboro;
	border: 1px solid gainsboro;
}

#div3 {
	min-width: 780px;
	height: 280px;
}

#div4 {
	min-width: 740px;
	height: 280px;
	margin-left: 40px;
}

.dv {
	min-width: 740px;
	height: 35px;
	margin-top: 60px;
}

.dv2 {
	width: 50px;
	line-height: 30px;
	float: left;
	text-align: right;
	vertical-align: middle;
}

.dv3 {
	min-width: 680px;
	line-height: 30px;
	margin-left: 75px;
}

.div3 {
	min-width: 680px;
	line-height: 30px;
	margin-left: 75px;
}

span {
	font-size: 14px;
	color: grey;
}

#div5 {
	margin-top: 30px;
	margin-left: 75px;
}
</style>
</head>
<body>
	<div id="div1">
		<div id="div2">
			<h2>修改昵称</h2>
		</div>
		<div id="div3">
			<div id="div4">
				<form id="form1">
					<div class="dv">
						<div class="dv2">新昵称</div>
						<div class="dv3">
							<input type="text" name="userName"
								placeholder="4-30个字符,支持中英文、数字_或-"
								style="color: grey; width: 200px; height: 30px" id="userName">
						</div>
					</div>
					<div id="div5">
						<button type="button" id="tijiao"
							style="width: 56px; height: 32px">提交</button>
						<!-- onclick="tijiao('form1')" -->
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript"
	src="https://cdn.bootcss.com/jquery/2.2.2/jquery.js"></script>

<script type="text/javascript">
	$(function() {//窗口加载完毕
		$('#tijiao').click(function() {
			var username = $('#userName').val();
			$.ajax({
				url : '/pan/updateName',
				type : 'POST',
				data : {
					userName : username
				},
				success : function(data) {
					if (data.statusCode == 200) {
//						setCookie('userName',username);   //设置修改昵称后的cookie
						alert("修改成功");
//						window.location.reload();//刷新当前页面
						parent.location.reload();//同步刷新页面
					}
				},
				error : function(err) {
					console.log(err);
				}
			});
		})
	});
</script>
</html>